<template>
  <div>
    <tempChild :tempData="tempData">
      <template v-slot:default="propsValue">
        <strong v-if="propsValue.value==='wangjian'">{{propsValue.value}}</strong>
        <span v-else>{{propsValue.value}}</span>
      </template>
    </tempChild>
    <el-button type="primary" @click="addTempData">增加循环</el-button>
  </div>
</template>
<script>
import tempChild from './TempChild.vue'
export default {
  data () {
    return {
      tempData: {
        a: 'a.obj'
      }
    }
  },
  methods: {
    addTempData () {
      // console.log(this.tempData.slice(-1)[0])
      // const newId = this.tempData.slice(-1)[0].id + 1
      // this.tempData.push({ id: newId, value: 'wangjian' })
      // console.log(this.tempData)
      this.$set(this.tempData, 'b', 'b.obj')
      setTimeout(() => {
        this.$delete(this.tempData, 'b')
        console.log(this.tempData)
      }, 1000)
    }
  },
  components: {
    tempChild
  }
}
</script>
<style lang="less" scoped>
</style>
